Skip to content

Conversation

@vikri-odoo
Copy link

@vikri-odoo vikri-odoo commented Dec 16, 2025

Here I have created new add-on for on-boarding tutorial project

what I have done?

  1. Chapter 1: create new add-on for real estate project
  2. Chapter 2: Make your application available in apps
  3. Chapter 3: Created first model for real estate properties
  4. Chapter 4: Added the access rights and basic demo data for properties
  5. Chapter 5: Added Views to see something in action
  6. Chapter 6: Understand how list and form works and create views for properties
  7. Chapter 7: Create one2Many, many2many and many2one relations for properties with Types, tags and offers
  8. Chapter 8: Create methods for onChange and compute to auto set fields
  9. Chapter 9: Added actions for buttons to directly update the model values

@robodoo
Copy link

robodoo commented Dec 16, 2025

Pull request status dashboard

Copy link

@barracudapps barracudapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments here and there. Can you also please review your PR title and description following our guidelines (https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html)?
A clear commit message is really important to describe what you did and why you did it.

Completed till chapter 7 many to one
@vikri-odoo vikri-odoo changed the title [ADD] new addon for real estate onboarding project 19.0 Estate tutorial (VIKRI) Dec 17, 2025
Added new tags model to understand many2many
postcode = fields.Char(string="Postcode")
date_availability = fields.Datetime(string="Date Availability", default=_set_default_start_date(), copy=False)
date_availability = fields.Datetime(
string="Date Availability", default=_set_default_start_date(), copy=False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a trailing coma here so if someone has to add a new parameter on a new line, that person won't have to change your line (and change the git history)

<field name="description">Description 3</field>
<field name="postcode">1040</field>
<field name="date_availability" eval="DateTime.now()" />
<field name="date_availability" eval="DateTime.now()"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date_availability is already pre-defined in your model with your default value

state = fields.Selection(
string="State",
selection=[
("new", "New"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use double quotes (") only for non-technical strings.
Please check all your files

access_estate_property,access.estate.property,model_estate_property,base.group_user,1,1,1,1
access_estate_property_type,access.estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_type,access.estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tags,access.estate.property.tags,model_estate_property_tags,base.group_user,1,1,1,1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget Unix conventions on text files' structure based on a line definition (cf. https://peps.python.org/pep-0008/ and https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206)

Check other files too

Comment on lines 3 to 8
<menuitem
id="estate_menu_action"
action="test_model_action"
parent="estate_menu_root"
sequence="1"
/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep this on a single line. It's not always easy to know when to write multiple lines but the basic rule is that you try to optimize readability AND number of lines

<?xml version="1.0"?>
<odoo>
<!-- Root menuitem action which will help us to see the default action window-->
<!-- Root menuitem action which will help us to see the default action window-->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is useless as the majority of the developers will easily know what your code is doing

Check the style guide and resolve the issues
1.create new model and view for offers
2.complete chapter 7
1. Sold and cancel button and actions added
2. Accept and reject button added with actions for offers
expected and offer price must be strictly positive
Selling price must be positive
Tag name should be unique
1.use status bar widget to show the state of the property
2. add default sorting order for the models
3. add colors for tag model
4. add invisible in the needed places as mentioned in the task
5. make the offer and tag editable in list view
Copy link

@barracudapps barracudapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the module !
Still some small suggestions but LGTM 👍

You can mark as ready (kind of message you'll get in R&D but cannot be applied here)

def action_set_sold(self):
for record in self:
if record.state == 'cancelled':
raise UserError("This property cannot be sold.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark your strings as translatable using self.env._ method

Comment on lines +12 to +15
_name_uniq = models.Constraint(
'unique (name)',
"This tag is already available",
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fits a single line



class EstatePropertyType(models.Model):
_name = "estate.property.type"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are tech strings 😉

<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Estate" decoration-success="state=='offered' or state=='accepted'" decoration-bf="state=='accepted'" decoration-muted="state=='sold'">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try using in to check multiple possible values (instead of or)

<field name="postcode"/>
<filter name="available" string="Available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<filter name="inactive" string="Archived" domain="[('active', '=', False)]"/>
<field name="living_area" string="Living Area (sqm)" filter_domain="[('living_area', '>=', self)]"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer this for stability

Suggested change
<field name="living_area" string="Living Area (sqm)" filter_domain="[('living_area', '>=', self)]"/>
<field name="living_area" string="Living Area (sqm)" filter_domain="[('living_area', '&gt;=', self)]"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants